forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Made BuildColorMaps redundant by using static tables #5289
Merged
Bassoonian
merged 14 commits into
rh-hideout:upcoming
from
PokemonSanFran:removeColorMaps
Sep 10, 2024
Merged
Made BuildColorMaps redundant by using static tables #5289
Bassoonian
merged 14 commits into
rh-hideout:upcoming
from
PokemonSanFran:removeColorMaps
Sep 10, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkmnsnfrn
added
type: cleanup
category: overworld
Pertains to out-of-battle mechanics
type: refactor
labels
Aug 30, 2024
Bassoonian
reviewed
Sep 6, 2024
Bassoonian
reviewed
Sep 8, 2024
Bassoonian
approved these changes
Sep 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
BuildColorMaps
redundant by using static tablesUsage
This feature is automatically used and requires no input from the developer or user.
Functionality
First, open
include/field_weather.h
. We're in here to remove the color maps from struct Weather, since they will be const data in ROM now. As a bonus, this frees up 1216 bytes in EWRAM! That's 0.46%!When the player enters a new map in vanilla, the
BuildColorMaps()
function does a lot of expensive computations to create color maps used to transform palette colors for weather effects. These computations however, produce the same arrays every time they are run.This PR will save the wasted computation by precomputing these color maps and removing the function altogether. This has the bonus effect of reducing EWRAM from 244554 B to 243338 B (a 0.4972% decrease)!
Testing
Clean Branch
You can recreate this branch by applying a patch or pulling the repo. From a clean version of expansion's upcoming, you can either:
Patch
wget https://files.catbox.moe/iqknfq.patch -O color.patch ; git apply color.patch ; rm color.patch
Repo
git remote add psf-expansion https://github.com/PokemonSanFran/pokeemerald-expansion/ ; git pull psf-expansion removeColorMaps
Manual Tests
Manual Testing
Verified Scenarios
All videos attempt to show all the weathers from
SUNNY_CLOUDS
throughUNDERWATER_BUBBLES
using the Manual Testing list.Static Tables (this PR)
true.mp4
Build Color Maps (vanilla)
false2.mp4
People who collaborated with me in this PR
This was originally written by by @Deokishisu. @ShinyDragonHunter assisted with DOWP.
Discord Contact Info
I am
pkmnsnfrn
on Discord.